package com.lili.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lili.controller.request.*;
import com.lili.po.*;
import com.lili.service.XasGoodsService;
import com.lili.uitl.OssUtil;
import com.lili.vo.MyPage;
import com.lili.vo.ResponseResult;
import com.lili.vo.XasGoodsCategoryListVo;
import com.lili.vo.XasGroupBuyRecordsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("goods")
public class XasGoodsController {
    @Autowired
    XasGoodsService xasGoodsService;


    //上传图片
    @RequestMapping("upFilePic")
    public ResponseResult upFilePic(@RequestParam("file") MultipartFile file) {
        ResponseResult responseResult = new ResponseResult();
        try {
            String resultRul = OssUtil.ossUpFile(file.getInputStream(), file.getOriginalFilename());
            responseResult.setData(resultRul);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    //商品分类
    @RequestMapping("secGoodsCategory")
    public ResponseResult secGoodsCategory() {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsCategoryListVo> xasGoodsCategoryListVos = xasGoodsService.secGoodsCategory();
        responseResult.setData(xasGoodsCategoryListVos);
        return responseResult;
    }


    @RequestMapping("thrGoodsCategory")
    public ResponseResult thrGoodsCategory() {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsCategoryListVo> xasGoodsCategoryListVos = xasGoodsService.thrGoodsCategory();
        responseResult.setData(xasGoodsCategoryListVos);
        return responseResult;
    }

    @RequestMapping("selectGoodsCategory")
    public ResponseResult selectGoodsCategory(@RequestBody XasGoodsCategoryRequest xasGoodsCategoryRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        //dddd
        BeanUtils.copyProperties(xasGoodsCategoryRequest, myPage);
        IPage<XasGoodsCategoryList> iPage = xasGoodsService.selectGoodsCategory(xasGoodsCategoryRequest);
        myPage.setTotal(iPage.getTotal());
        myPage.setRecords(iPage.getRecords());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addGoodsCategory")
    public ResponseResult addGoodsCategory(@RequestBody XasGoodsCategoryList xasGoodsCategoryList) {
        if (xasGoodsCategoryList.getPid() == null) {
            xasGoodsCategoryList.setPid(0);
        }
        xasGoodsService.addGoodsCategory(xasGoodsCategoryList);
        return new ResponseResult();
    }

    @RequestMapping("updateGoodsCategory")
    public ResponseResult updateGoodsCategory(@RequestBody XasGoodsCategoryList xasGoodsCategoryList) {
        if (xasGoodsCategoryList.getPid() == null) {
            xasGoodsCategoryList.setPid(0);
        }
        xasGoodsService.updateGoodsCategory(xasGoodsCategoryList);
        return new ResponseResult();
    }

    @RequestMapping("delGoodsCategory")
    public ResponseResult delGoodsCategory(@RequestBody XasGoodsCategoryList xasGoodsCategoryList) {
        xasGoodsService.delGoodsCategory(xasGoodsCategoryList.getId());
        return new ResponseResult();
    }
    //商品分类结束

    //商品品牌
    @RequestMapping("selectXasGoodsBrand")
    public ResponseResult selectXasGoodsBrand(@RequestBody XasGoodsBrandRequest xasGoodsBrandRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsBrandRequest, myPage);
        IPage<XasGoodsBrandList> iPage = xasGoodsService.selectXasGoodsBrand(xasGoodsBrandRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasGoodsBrand")
    public ResponseResult addXasGoodsBrand(@RequestBody XasGoodsBrandList xasGoodsBrandList) {
        xasGoodsService.addXasGoodsBrand(xasGoodsBrandList);
        return new ResponseResult();
    }

    @RequestMapping("updateXasGoodsBrand")
    public ResponseResult updateXasGoodsBrand(@RequestBody XasGoodsBrandList xasGoodsBrandList) {
        xasGoodsService.updateXasGoodsBrand(xasGoodsBrandList);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsBrand")
    public ResponseResult delXasGoodsBrand(@RequestBody XasGoodsPropConfig xasGoodsPropConfig) {
        xasGoodsService.delXasGoodsBrand(xasGoodsPropConfig.getId());
        return new ResponseResult();
    }
    //商品品牌结束


    //商品属性开始----------------------------------------------
    @RequestMapping("selectXasGoodsProp")
    public ResponseResult selectXasGoodsProp(@RequestBody XasGoodsPropRequest xasGoodsPropRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsPropRequest, myPage);
        IPage<XasGoodsPropList> iPage = xasGoodsService.selectXasGoodsProp(xasGoodsPropRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("selectAllXasGoodsProp")
    public ResponseResult selectAllXasGoodsProp() {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsPropList> xasGoodsPropLists = xasGoodsService.selectAllXasGoodsProp();
        responseResult.setData(xasGoodsPropLists);
        return responseResult;
    }


    @RequestMapping("addXasGoodsProp")
    public ResponseResult addXasGoodsProp(@RequestBody XasGoodsPropList xasGoodsPropList) {
        xasGoodsService.addXasGoodsProp(xasGoodsPropList);
        return new ResponseResult();
    }

    @RequestMapping("updateXasGoodsProp")
    public ResponseResult updateXasGoodsProp(@RequestBody XasGoodsPropList xasGoodsPropList) {
        xasGoodsService.updateXasGoodsProp(xasGoodsPropList);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsProp")
    public ResponseResult delXasGoodsProp(@RequestBody XasGoodsPropList xasGoodsPropList) {
        xasGoodsService.delXasGoodsProp(xasGoodsPropList.getId());
        return new ResponseResult();
    }
    //商品属性结束----------------------------------


    //商品属性值开始----------------------------------------------
    @RequestMapping("selectXasGoodsPropValue")
    public ResponseResult selectXasGoodsPropValue(@RequestBody XasGoodsPropValueRequest xasGoodsPropValueRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsPropValueRequest, myPage);
        IPage<XasGoodsPropValueList> iPage = xasGoodsService.selectXasGoodsPropValue(xasGoodsPropValueRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasGoodsPropValue")
    public ResponseResult addXasGoodsPropValue(@RequestBody XasGoodsPropValueList xasGoodsPropValueList) {
        xasGoodsService.addXasGoodsPropValue(xasGoodsPropValueList);
        return new ResponseResult();
    }

    @RequestMapping("updateXasGoodsPropValue")
    public ResponseResult updateXasGoodsPropValue(@RequestBody XasGoodsPropValueList xasGoodsPropValueList) {
        xasGoodsService.updateXasGoodsPropValue(xasGoodsPropValueList);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsPropValue")
    public ResponseResult delXasGoodsPropValue(@RequestBody XasGoodsPropList xasGoodsPropList) {
        xasGoodsService.delXasGoodsPropValue(xasGoodsPropList.getId());
        return new ResponseResult();
    }
    //商品属性值结束----------------------------------


    //商品属性配置开始
    @RequestMapping("selectXasGoodsPropConfig")
    public ResponseResult selectXasGoodsPropConfig(@RequestBody XasGoodsPropConfigRequest xasGoodsPropConfigRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsPropConfigRequest, myPage);
        IPage<XasGoodsPropConfig> iPage = xasGoodsService.selectXasGoodsPropConfig(xasGoodsPropConfigRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasGoodsPropConfig")
    public ResponseResult addXasGoodsPropConfig(@RequestBody XasGoodsPropConfig xasGoodsPropConfig) {
        boolean b = xasGoodsService.addXasGoodsPropConfig(xasGoodsPropConfig);
        if (b) {
            return new ResponseResult();
        }
        ResponseResult responseResult = new ResponseResult();
        responseResult.setCode(0);
        responseResult.setMsg("该商品已配置该属性");
        return responseResult;

    }

    @RequestMapping("updateXasGoodsPropConfig")
    public ResponseResult updateXasGoodsPropConfig(@RequestBody XasGoodsPropConfig xasGoodsPropConfig) {
        xasGoodsService.updateXasGoodsPropConfig(xasGoodsPropConfig);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsPropConfig")
    public ResponseResult delXasGoodsPropConfig(@RequestBody XasGoodsPropConfig xasGoodsPropConfig) {
        xasGoodsService.delXasGoodsPropConfig(xasGoodsPropConfig.getId());
        return new ResponseResult();
    }
    //商品属性配置结束

    //商品SKU 开始
    @RequestMapping("selectXasGoodsSkuConfig")
    public ResponseResult selectXasGoodsSkuConfig(@RequestBody XasGoodsSkuConfigRequest xasGoodsSkuConfigRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsSkuConfigRequest, myPage);
        IPage<XasGoodsSkuConfig> iPage = xasGoodsService.selectXasGoodsSkuConfig(xasGoodsSkuConfigRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }


    @RequestMapping("selectXasGoodsSkuConfigByGid")
    public ResponseResult selectXasGoodsSkuConfigByGid(@RequestBody XasGoodsSkuConfigRequest xasGoodsSkuConfigRequest) {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsSkuConfig> xasGoodsSkuConfigs = xasGoodsService.selectXasGoodsSkuConfigByGid(xasGoodsSkuConfigRequest.getGid());
        responseResult.setData(xasGoodsSkuConfigs);
        return responseResult;
    }

    @RequestMapping("selectXasGoodsSkuPropConfig")
    public ResponseResult selectXasGoodsSkuPropConfig(@RequestBody XasGoodsList xasGoodsList) {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsPropList> xasGoodsPropLists = xasGoodsService.selectXasGoodsSkuPropConfig(xasGoodsList.getId());
        responseResult.setData(xasGoodsPropLists);
        return responseResult;
    }


    @RequestMapping("addXasGoodsSkuConfig")
    public ResponseResult addXasGoodsSkuConfig(@RequestBody XasGoodsSkuConfig xasGoodsSkuConfig) {
        xasGoodsService.addXasGoodsSkuConfig(xasGoodsSkuConfig);
        return new ResponseResult();
    }


    @RequestMapping("updateXasGoodsSkuConfig")
    public ResponseResult updateXasGoodsSkuConfig(@RequestBody XasGoodsSkuConfig xasGoodsSkuConfig) {
        xasGoodsService.updateXasGoodsSkuConfig(xasGoodsSkuConfig);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsSkuConfig")
    public ResponseResult delXasGoodsSkuConfig(@RequestBody XasGoodsSkuConfig xasGoodsSkuConfig) {
        xasGoodsService.delXasGoodsSkuConfig(xasGoodsSkuConfig.getId());
        return new ResponseResult();
    }
    //商品SKU 结束


    //商品信息开始
    @RequestMapping("selectXasGoodsList")
    public ResponseResult selectXasGoodsList(@RequestBody XasGoodsListRequest xasGoodsListRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsListRequest, myPage);
        IPage<XasGoodsList> iPage = xasGoodsService.selectXasGoodsList(xasGoodsListRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    //商品信息开始
    @RequestMapping("selectXasGoodsListById")
    public ResponseResult selectXasGoodsListById(@RequestBody XasGoodsList xasGoodsList) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsList, myPage);
        XasGoodsList xasGoodsListResult = xasGoodsService.selectXasGoodsListById(xasGoodsList.getId());
        responseResult.setData(xasGoodsListResult);
        return responseResult;
    }

    @RequestMapping("selectAllXasGoodsList")
    public ResponseResult selectAllXasGoodsList() {
        ResponseResult responseResult = new ResponseResult();
        List<XasGoodsCategoryListVo> xasGoodsCategoryListVos = xasGoodsService.selectAllXasGoodsList();
        responseResult.setData(xasGoodsCategoryListVos);
        return responseResult;
    }

    @RequestMapping("addXasGoodsList")
    public ResponseResult addXasGoodsList(@RequestBody XasGoodsList xasGoodsList) {
        xasGoodsService.addXasGoodsList(xasGoodsList);
        return new ResponseResult();
    }

    @RequestMapping("updateXasGoodsList")
    public ResponseResult updateXasGoodsList(@RequestBody XasGoodsList xasGoodsList) {
        xasGoodsService.updateXasGoodsList(xasGoodsList);
        return new ResponseResult();
    }

    @RequestMapping("delXasGoodsList")
    public ResponseResult delXasGoodsList(@RequestBody XasGoodsList xasGoodsList) {
        xasGoodsService.delXasGoodsList(xasGoodsList.getId());
        return new ResponseResult();
    }
    //商品信息结束


    //拼团商品开始
    @RequestMapping("selectXasGroupBuyGoods")
    public ResponseResult selectXasGroupBuyGoods(@RequestBody XasGroupBuyGoodsRequest xasGroupBuyGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGroupBuyGoodsRequest, myPage);
        IPage<XasGroupBuyRecordsVo> iPage = xasGoodsService.selectXasGroupBuyGoods(xasGroupBuyGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasGroupBuyGoods")
    public ResponseResult addXasGroupBuyGoods(@RequestBody XasGroupBuyGoods xasGroupBuyGoods) {
        xasGoodsService.addXasGroupBuyGoods(xasGroupBuyGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasGroupBuyGoods")
    public ResponseResult updateXasGroupBuyGoods(@RequestBody XasGroupBuyGoods xasGroupBuyGoods) {
        xasGoodsService.updateXasGroupBuyGoods(xasGroupBuyGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasGroupBuyGoods")
    public ResponseResult delXasGroupBuyGoods(@RequestBody XasGroupBuyGoods xasGroupBuyGoods) {
        xasGoodsService.delXasGroupBuyGoods(xasGroupBuyGoods.getId());
        return new ResponseResult();
    }


    //热卖商品开始
    @RequestMapping("selectXasHotSalesGoods")
    public ResponseResult selectXasHotSalesGoods(@RequestBody XasHotSalesGoodsRequest xasHotSalesGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasHotSalesGoodsRequest, myPage);
        IPage<XasHotSalesGoods> iPage = xasGoodsService.selectXasHotSalesGoods(xasHotSalesGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasHotSalesGoods")
    public ResponseResult addXasHotSalesGoods(@RequestBody XasHotSalesGoods xasHotSalesGoods) {
        xasGoodsService.addXasHotSalesGoods(xasHotSalesGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasHotSalesGoods")
    public ResponseResult updateXasHotSalesGoods(@RequestBody XasHotSalesGoods xasHotSalesGoods) {
        xasGoodsService.updateXasHotSalesGoods(xasHotSalesGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasHotSalesGoods")
    public ResponseResult delXasHotSalesGoods(@RequestBody XasHotSalesGoods xasHotSalesGoods) {
        xasGoodsService.delXasHotSalesGoods(xasHotSalesGoods.getId());
        return new ResponseResult();
    }

    //热卖商品结束


    //top商品开始
    @RequestMapping("selectXasTopRankGoods")
    public ResponseResult selectXasTopRankGoods(@RequestBody XasTopRankGoodsRequest xasTopRankGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasTopRankGoodsRequest, myPage);
        IPage<XasTopRankGoods> iPage = xasGoodsService.selectXasTopRankGoods(xasTopRankGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasTopRankGoods")
    public ResponseResult addXasTopRankGoods(@RequestBody XasTopRankGoods xasTopRankGoods) {
        xasGoodsService.addXasTopRankGoods(xasTopRankGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasTopRankGoods")
    public ResponseResult updateXasTopRankGoods(@RequestBody XasTopRankGoods xasTopRankGoods) {
        xasGoodsService.updateXasTopRankGoods(xasTopRankGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasTopRankGoods")
    public ResponseResult delXasTopRankGoods(@RequestBody XasTopRankGoods xasTopRankGoods) {
        xasGoodsService.delXasTopRankGoods(xasTopRankGoods.getId());
        return new ResponseResult();
    }

    //限购商品开始
    @RequestMapping("selectXasLimitedGoods")
    public ResponseResult selectXasLimitedGoods(@RequestBody XasLimitedGoodsRequest xasLimitedGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasLimitedGoodsRequest, myPage);
        IPage<XasLimitedGoods> iPage = xasGoodsService.selectXasLimitedGoods(xasLimitedGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasLimitedGoods")
    public ResponseResult addXasLimitedGoods(@RequestBody XasLimitedGoods xasLimitedGoods) {
        xasGoodsService.addXasLimitedGoods(xasLimitedGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasLimitedGoods")
    public ResponseResult updateXasLimitedGoods(@RequestBody XasLimitedGoods xasLimitedGoods) {
        xasGoodsService.updateXasLimitedGoods(xasLimitedGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasLimitedGoods")
    public ResponseResult delXasLimitedGoods(@RequestBody XasLimitedGoods xasLimitedGoods) {
        xasGoodsService.delXasLimitedGoods(xasLimitedGoods.getId());
        return new ResponseResult();
    }
    //限购商品结束


    //新品上市开始
    @RequestMapping("selectXasNewGoods")
    public ResponseResult selectXasNewGoods(@RequestBody XasNewGoodsRequest xasNewGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasNewGoodsRequest, myPage);
        IPage<XasNewGoods> iPage = xasGoodsService.selectXasNewGoods(xasNewGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasNewGoods")
    public ResponseResult addXasNewGoods(@RequestBody XasNewGoods xasNewGoods) {
        xasGoodsService.addXasNewGoods(xasNewGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasNewGoods")
    public ResponseResult updateXasNewGoods(@RequestBody XasNewGoods xasNewGoods) {
        xasGoodsService.updateXasNewGoods(xasNewGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasNewGoods")
    public ResponseResult delXasNewGoods(@RequestBody XasNewGoods xasNewGoods) {
        xasGoodsService.delXasNewGoods(xasNewGoods.getId());
        return new ResponseResult();
    }
    //新品上市结束

    //推荐商品开始
    @RequestMapping("selectXasRecommendGoods")
    public ResponseResult selectXasRecommendGoods(@RequestBody XasRecommendGoodsRequest xasRecommendGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasRecommendGoodsRequest, myPage);
        IPage<XasRecommendGoods> iPage = xasGoodsService.selectXasRecommendGoods(xasRecommendGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasRecommendGoods")
    public ResponseResult addXasRecommendGoods(@RequestBody XasRecommendGoods xasRecommendGoods) {
        xasGoodsService.addXasRecommendGoods(xasRecommendGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasRecommendGoods")
    public ResponseResult updateXasRecommendGoods(@RequestBody XasRecommendGoods xasRecommendGoods) {
        xasGoodsService.updateXasRecommendGoods(xasRecommendGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasRecommendGoods")
    public ResponseResult delXasRecommendGoods(@RequestBody XasRecommendGoods xasRecommendGoods) {
        xasGoodsService.delXasRecommendGoods(xasRecommendGoods.getId());
        return new ResponseResult();
    }
    //推荐商品结束

    //活动商品开始
    @RequestMapping("selectXasActivityGoods")
    public ResponseResult selectXasActivityGoods(@RequestBody XasActivityGoodsRequest xasActivityGoodsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasActivityGoodsRequest, myPage);
        IPage<XasActivityGoods> iPage = xasGoodsService.selectXasActivityGoods(xasActivityGoodsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }

    @RequestMapping("addXasActivityGoods")
    public ResponseResult addXasActivityGoods(@RequestBody XasActivityGoods xasActivityGoods) {
        xasGoodsService.addXasActivityGoods(xasActivityGoods);
        return new ResponseResult();
    }

    @RequestMapping("updateXasActivityGoods")
    public ResponseResult updateXasActivityGoods(@RequestBody XasActivityGoods xasActivityGoods) {
        xasGoodsService.updateXasActivityGoods(xasActivityGoods);
        return new ResponseResult();
    }

    @RequestMapping("delXasActivityGoods")
    public ResponseResult delXasActivityGoods(@RequestBody XasActivityGoods xasActivityGoods) {
        xasGoodsService.delXasActivityGoods(xasActivityGoods.getId());
        return new ResponseResult();
    }

    //商品评价开始
    @RequestMapping("selectXasGoodsCommentList")
    public ResponseResult selectXasGoodsCommentList(@RequestBody XasGoodsCommentListRequest xasGoodsCommentListRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGoodsCommentListRequest, myPage);
        IPage<XasGoodsCommentList> iPage = xasGoodsService.selectXasGoodsCommentList(xasGoodsCommentListRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }


    @RequestMapping("examineXasGoodsCommentList")
    public ResponseResult examineXasGoodsCommentList(@RequestBody XasGoodsCommentListRequest xasGoodsCommentListRequest) {
        ResponseResult responseResult = new ResponseResult();
        xasGoodsService.examineXasGoodsCommentList(xasGoodsCommentListRequest.getId(), xasGoodsCommentListRequest.getStatus());
        return responseResult;
    }

//    @RequestMapping("addXasGoodsCommentList")
//    public ResponseResult addXasGoodsCommentList(@RequestBody XasGoodsCommentList xasGoodsCommentList) {
//        xasGoodsService.addXasGoodsCommentList(xasGoodsCommentList);
//        return new ResponseResult();
//    }
//
//    @RequestMapping("updateXasGoodsCommentList")
//    public ResponseResult updateXasGoodsCommentList(@RequestBody XasGoodsCommentList xasGoodsCommentList) {
//        xasGoodsService.updateXasGoodsCommentList(xasGoodsCommentList);
//        return new ResponseResult();
//    }
//
//    @RequestMapping("delXasGoodsCommentList")
//    public ResponseResult delXasGoodsCommentList(@RequestBody XasGoodsCommentList xasGoodsCommentList) {
//        xasGoodsService.delXasGoodsCommentList(xasGoodsCommentList.getId());
//        return new ResponseResult();
//    }
    //商品评价结束

    //拼团记录
    @RequestMapping("selectXasGroupBuyJoinRecords")
    public ResponseResult selectXasGroupBuyJoinRecords(@RequestBody XasGroupBuyJoinRecordsRequest xasGroupBuyJoinRecordsRequest) {
        MyPage myPage = new MyPage();
        ResponseResult responseResult = new ResponseResult();
        BeanUtils.copyProperties(xasGroupBuyJoinRecordsRequest, myPage);
        IPage<XasGroupBuyJoinRecords> iPage = xasGoodsService.selectXasGroupBuyJoinRecords(xasGroupBuyJoinRecordsRequest);
        myPage.setRecords(iPage.getRecords());
        myPage.setTotal(iPage.getTotal());
        responseResult.setData(myPage);
        return responseResult;
    }
}
